//
//  AppTheme.swift
//  CMB250716
//
//  Created by Assistant on 2025-01-02.
//

import SwiftUI

/// 应用主题系统
struct AppTheme {
    
    // MARK: - 颜色主题
    struct Colors {
        // 主色调
        static let primary = Color.orange
        static let secondary = Color.blue
        
        // 强调色 - 优化对比度和视觉效果
        static let accent = Color(red: 1.0, green: 0.84, blue: 0.0) // 金黄色
        static let accentSecondary = Color(red: 1.0, green: 0.7, blue: 0.3) // 优化橙色，提高可见度
        static let accentGradient = [
            Color(red: 1.0, green: 0.84, blue: 0.0),
            Color(red: 0.9, green: 0.7, blue: 0.1) // 优化渐变，增强视觉效果
        ]
        
        // 背景色 - 优化深色主题的层次感
        static let background = Color.black
        static let backgroundSecondary = Color(red: 0.12, green: 0.12, blue: 0.15) // 稍微提亮
        static let backgroundTertiary = Color(red: 0.18, green: 0.18, blue: 0.22) // 增强层次
        static let backgroundGradient = [
            Color(red: 0.06, green: 0.06, blue: 0.12), // 优化渐变起点
            Color(red: 0.12, green: 0.12, blue: 0.18), // 增强中间色
            Color(red: 0.09, green: 0.09, blue: 0.15)  // 优化渐变终点
        ]
        static let cardBackground = Color.white
        static let surfaceBackground = Color(red: 0.15, green: 0.15, blue: 0.18) // 优化表面背景
        
        // 文本色 - 优化可读性和对比度
        static let primaryText = Color.white
        static let secondaryText = Color.white.opacity(0.85) // 改为适合深色背景的颜色
        static let captionText = Color.white.opacity(0.7) // 优化说明文字颜色
        
        // 状态色
        static let success = Color.green
        static let warning = Color.orange
        static let error = Color.red
        static let info = Color.blue
        
        // 透明度常量
        static let veryLightOpacity: Double = 0.05
        static let lightOpacity: Double = 0.1
        static let mediumLightOpacity: Double = 0.2
        static let mediumOpacity: Double = 0.3
        static let mediumHeavyOpacity: Double = 0.5
        static let heavyOpacity: Double = 0.6
        static let veryHeavyOpacity: Double = 0.8
        
        // 阴影色
        static let shadow = Color.black.opacity(0.1)
        static let shadowMedium = Color.black.opacity(0.2)
        static let shadowStrong = Color.black.opacity(0.3)
        static let shadowLight = Color.black.opacity(lightOpacity)
        static let shadowHeavy = Color.black.opacity(heavyOpacity)
        
        // 边框色
        static let border = Color.white.opacity(0.3)
        static let borderSecondary = Color.gray.opacity(0.5)
    }
    
    // MARK: - 尺寸主题
    struct Dimensions {
        // 圆角
        static let smallCornerRadius: CGFloat = 8
        static let mediumCornerRadius: CGFloat = 12
        static let largeCornerRadius: CGFloat = 16
        static let extraLargeCornerRadius: CGFloat = 20
        
        // 内边距
        static let tinyPadding: CGFloat = 4
        static let smallPadding: CGFloat = 8
        static let mediumPadding: CGFloat = 16
        static let largePadding: CGFloat = 24
        static let extraLargePadding: CGFloat = 32
        
        // 间距
        static let tinySpacing: CGFloat = 4
        static let smallSpacing: CGFloat = 8
        static let mediumSpacing: CGFloat = 12
        static let largeSpacing: CGFloat = 16
        static let extraLargeSpacing: CGFloat = 24
        
        // 主页面专用间距
        static let homeSectionSpacing: CGFloat = 10  // 不同区域之间的间距
        static let homeSectionInternalSpacing: CGFloat = 8   // 区域内标题与内容间距（从16缩小到8）
        static let homeTopPadding: CGFloat = 68              // 主页面顶部内边距（从60增加到68）
        
        // 高度
        static let buttonHeight: CGFloat = 44
        static let smallButtonHeight: CGFloat = 36
        static let largeButtonHeight: CGFloat = 52
        static let cardHeight: CGFloat = 120
        static let largeCardHeight: CGFloat = 160
        
        // 宽度
        static let buttonMinWidth: CGFloat = 80
        static let cardMinWidth: CGFloat = 200
        
        // 阴影
        static let shadowRadius: CGFloat = 4
        static let largeShadowRadius: CGFloat = 8
        static let shadowOffsetY: CGFloat = 2
        static let largeShadowOffsetY: CGFloat = 4
    }
    
    // MARK: - 字体主题
    struct Typography {
        // 标题字体
        static let largeTitle = Font.system(size: 32, weight: .bold)
        static let title1 = Font.system(size: 28, weight: .bold)
        static let title2 = Font.system(size: 24, weight: .bold)
        static let title3 = Font.system(size: 20, weight: .semibold)
        
        // 正文字体
        static let headline = Font.system(size: 18, weight: .semibold)
        static let body = Font.system(size: 16, weight: .regular)
        static let bodyMedium = Font.system(size: 16, weight: .medium)
        static let bodySemibold = Font.system(size: 16, weight: .semibold)
        
        // 辅助字体
        static let callout = Font.system(size: 14, weight: .regular)
        static let calloutMedium = Font.system(size: 14, weight: .medium)
        static let subheadline = Font.system(size: 12, weight: .regular)
        static let footnote = Font.system(size: 10, weight: .regular)
        static let caption = Font.system(size: 10, weight: .medium)
        static let caption2 = Font.system(size: 8, weight: .regular)
        
        // 特殊字体
        static let displayLarge = Font.system(size: 60, weight: .bold)
        static let displayMedium = Font.system(size: 80, weight: .bold)
        static let numberLarge = Font.system(size: 26, weight: .bold)
    }
    
    // MARK: - 动画主题
    struct Animation {
        // 持续时间
        static let veryQuickDuration: Double = 0.1
        static let quickDuration: Double = 0.2
        static let standardDuration: Double = 0.3
        static let slowDuration: Double = 0.6
        static let verySlow: Double = 1.0
        static let extraSlow: Double = 1.2
        static let superSlow: Double = 1.5
        
        // 延迟时间
        static let staggerDelay: Double = 0.1
        static let shortDelay: Double = 0.2
        static let mediumDelay: Double = 0.5
        
        // 缩放效果
        static let scaleEffectSmall: CGFloat = 0.95
        static let scaleEffectMedium: CGFloat = 0.9
        static let scaleEffectLarge: CGFloat = 1.1
        
        // 动画类型
        static let easeInOut = SwiftUI.Animation.easeInOut
        static let spring = SwiftUI.Animation.spring()
        static let linear = SwiftUI.Animation.linear
    }
}